//
//  NSAttributedString+Extension.swift
//  weibo
//
//  Created by Ning Xie on 16/8/23.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

extension NSAttributedString {

   class func attributedStringWithEmoticon(emoticon:ZCEmoticonModel,font:UIFont)->NSAttributedString{
        
        let image = UIImage(named: (emoticon.path)!)
        let attachment = ZCTextAttachment()
        attachment.emoticonModel = emoticon
        let fontHeight = font.lineHeight
        attachment.bounds = CGRect(x: 0, y: -4, width: fontHeight, height: fontHeight)
        attachment.image = image
        let attributed = NSAttributedString(attachment: attachment)

        return attributed
    }

}